/*
 * @Author: sxb
 * @Email: sxb@mail.com
 * @Date: 2020-02-12 09:37:12
 * @Descripttion: 
 */
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';

import { Observable } from "rxjs"

@Injectable({
  providedIn: 'root'
})
export class TabManageService {

  private materialLabelUrl = '/api/materialLabel';
  getMaterialLabelList(data): Observable<any> {
    return this.http.get(this.materialLabelUrl+"?code="+ data.code +"&name="+ data.name +"&page="+ data.page +"&size="+data.size+"&sort=createDate,desc", {}).pipe()
  }
  postMaterialLabel(data): Observable<any> {
    return this.http.post(this.materialLabelUrl, data).pipe()
  }
  putMaterialLabel(data): Observable<any> {
    return this.http.put(this.materialLabelUrl, data).pipe()
  }
  /**
   * @Author: sxb
   * @Email: sxb@mail.com
   * @Date: 2020-03-30 16:23:41
   * @UseComponent: 
   * @Descripttion: 删除物料标签
   * @Return: 
   */
  delMaterialLabel(data): Observable<any> {
    let _dataJson = {
        headers: new HttpHeaders({ 'Content-Type': 'application/json', }),
        body: data
    }
    return this.http.delete(this.materialLabelUrl, _dataJson).pipe();
  }
  /**
   * @Author: sxb
   * @Email: sxb@mail.com
   * @Date: 2020-03-30 16:22:14
   * @UseComponent: 
   * @Descripttion: 查询物料标签明细
   * @Return: 
   */
  private materialLabelDetailUrl: string = "/api/materialLabel/detail";
  findMaterialLabelDetailById(data): Observable<any> {
      let _dataJson = {
          params: data
      }
      return this.http.get(this.materialLabelDetailUrl, _dataJson)
  }


  private materialUrl = '/api/material';
  getMaterialList(data): Observable<any> {
    return this.http.get(this.materialUrl+"?code="+ data.code +"&name="+ data.name +"&page="+ data.page +"&size="+data.size, {}).pipe()
  }

  constructor(
    private http: HttpClient
    ) { }
}
